/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package Entity;

import java.io.Serializable;
import java.math.BigInteger;
import javax.persistence.Basic;
import javax.persistence.Column;
import javax.persistence.EmbeddedId;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.JoinColumn;
import javax.persistence.JoinColumns;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.OneToOne;
import javax.persistence.Table;
import javax.validation.constraints.NotNull;
import javax.xml.bind.annotation.XmlRootElement;

/**
 *
 * @author WinKiQue58
 */
@Entity
@Table(name = "COMMISSION")
@XmlRootElement
@NamedQueries({
    @NamedQuery(name = "Commission.findAll", query = "SELECT c FROM Commission c"),
    @NamedQuery(name = "Commission.findByIdCommission", query = "SELECT c FROM Commission c WHERE c.commissionPK.idCommission = :idCommission"),
    @NamedQuery(name = "Commission.findByIdRecord", query = "SELECT c FROM Commission c WHERE c.commissionPK.idRecord = :idRecord"),
    @NamedQuery(name = "Commission.findByIdPersonalInfo", query = "SELECT c FROM Commission c WHERE c.commissionPK.idPersonalInfo = :idPersonalInfo"),
    @NamedQuery(name = "Commission.findByIdBranchenterprise", query = "SELECT c FROM Commission c WHERE c.commissionPK.idBranchenterprise = :idBranchenterprise"),
    @NamedQuery(name = "Commission.findByIdEnterprise", query = "SELECT c FROM Commission c WHERE c.commissionPK.idEnterprise = :idEnterprise"),
    @NamedQuery(name = "Commission.findByPositionLevel", query = "SELECT c FROM Commission c WHERE c.positionLevel = :positionLevel"),
    @NamedQuery(name = "Commission.findByProduct", query = "SELECT c FROM Commission c WHERE c.product = :product"),
    @NamedQuery(name = "Commission.findByCampaign", query = "SELECT c FROM Commission c WHERE c.campaign = :campaign"),
    @NamedQuery(name = "Commission.findByAddfriend", query = "SELECT c FROM Commission c WHERE c.addfriend = :addfriend"),
    @NamedQuery(name = "Commission.findByNumberorders", query = "SELECT c FROM Commission c WHERE c.numberorders = :numberorders"),
    @NamedQuery(name = "Commission.findByNumberitemorder", query = "SELECT c FROM Commission c WHERE c.numberitemorder = :numberitemorder"),
    @NamedQuery(name = "Commission.findByNumberbuy", query = "SELECT c FROM Commission c WHERE c.numberbuy = :numberbuy"),
    @NamedQuery(name = "Commission.findByNumberitembuy", query = "SELECT c FROM Commission c WHERE c.numberitembuy = :numberitembuy")})
public class Commission implements Serializable {
    private static final long serialVersionUID = 1L;
    @EmbeddedId
    protected CommissionPK commissionPK;
    @Basic(optional = false)
    @NotNull
    @Column(name = "POSITION_LEVEL")
    private BigInteger positionLevel;
    @Basic(optional = false)
    @NotNull
    @Column(name = "PRODUCT")
    private BigInteger product;
    @Basic(optional = false)
    @NotNull
    @Column(name = "CAMPAIGN")
    private BigInteger campaign;
    @Basic(optional = false)
    @NotNull
    @Column(name = "ADDFRIEND")
    private BigInteger addfriend;
    @Basic(optional = false)
    @NotNull
    @Column(name = "NUMBERORDERS")
    private BigInteger numberorders;
    @Basic(optional = false)
    @NotNull
    @Column(name = "NUMBERITEMORDER")
    private BigInteger numberitemorder;
    @Basic(optional = false)
    @NotNull
    @Column(name = "NUMBERBUY")
    private BigInteger numberbuy;
    @Basic(optional = false)
    @NotNull
    @Column(name = "NUMBERITEMBUY")
    private BigInteger numberitembuy;
    @JoinColumns({
        @JoinColumn(name = "ID_RECORD", referencedColumnName = "ID_RECORD", insertable = false, updatable = false),
        @JoinColumn(name = "ID_PERSONAL_INFO", referencedColumnName = "ID_PERSONAL_INFO", insertable = false, updatable = false),
        @JoinColumn(name = "ID_BRANCHENTERPRISE", referencedColumnName = "ID_BRANCHENTERPRISE", insertable = false, updatable = false),
        @JoinColumn(name = "ID_ENTERPRISE", referencedColumnName = "ID_ENTERPRISE", insertable = false, updatable = false)})
    @OneToOne(optional = false, fetch = FetchType.LAZY)
    private Record record;

    public Commission() {
    }

    public Commission(CommissionPK commissionPK) {
        this.commissionPK = commissionPK;
    }

    public Commission(CommissionPK commissionPK, BigInteger positionLevel, BigInteger product, BigInteger campaign, BigInteger addfriend, BigInteger numberorders, BigInteger numberitemorder, BigInteger numberbuy, BigInteger numberitembuy) {
        this.commissionPK = commissionPK;
        this.positionLevel = positionLevel;
        this.product = product;
        this.campaign = campaign;
        this.addfriend = addfriend;
        this.numberorders = numberorders;
        this.numberitemorder = numberitemorder;
        this.numberbuy = numberbuy;
        this.numberitembuy = numberitembuy;
    }

    public Commission(BigInteger idCommission, BigInteger idRecord, BigInteger idPersonalInfo, BigInteger idBranchenterprise, BigInteger idEnterprise) {
        this.commissionPK = new CommissionPK(idCommission, idRecord, idPersonalInfo, idBranchenterprise, idEnterprise);
    }

    public CommissionPK getCommissionPK() {
        return commissionPK;
    }

    public void setCommissionPK(CommissionPK commissionPK) {
        this.commissionPK = commissionPK;
    }

    public BigInteger getPositionLevel() {
        return positionLevel;
    }

    public void setPositionLevel(BigInteger positionLevel) {
        this.positionLevel = positionLevel;
    }

    public BigInteger getProduct() {
        return product;
    }

    public void setProduct(BigInteger product) {
        this.product = product;
    }

    public BigInteger getCampaign() {
        return campaign;
    }

    public void setCampaign(BigInteger campaign) {
        this.campaign = campaign;
    }

    public BigInteger getAddfriend() {
        return addfriend;
    }

    public void setAddfriend(BigInteger addfriend) {
        this.addfriend = addfriend;
    }

    public BigInteger getNumberorders() {
        return numberorders;
    }

    public void setNumberorders(BigInteger numberorders) {
        this.numberorders = numberorders;
    }

    public BigInteger getNumberitemorder() {
        return numberitemorder;
    }

    public void setNumberitemorder(BigInteger numberitemorder) {
        this.numberitemorder = numberitemorder;
    }

    public BigInteger getNumberbuy() {
        return numberbuy;
    }

    public void setNumberbuy(BigInteger numberbuy) {
        this.numberbuy = numberbuy;
    }

    public BigInteger getNumberitembuy() {
        return numberitembuy;
    }

    public void setNumberitembuy(BigInteger numberitembuy) {
        this.numberitembuy = numberitembuy;
    }

    public Record getRecord() {
        return record;
    }

    public void setRecord(Record record) {
        this.record = record;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (commissionPK != null ? commissionPK.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof Commission)) {
            return false;
        }
        Commission other = (Commission) object;
        if ((this.commissionPK == null && other.commissionPK != null) || (this.commissionPK != null && !this.commissionPK.equals(other.commissionPK))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "Entity.Commission[ commissionPK=" + commissionPK + " ]";
    }
    
}
